//
//  DSSHProjectRockVC.m
//  DSSH
//
//  Created by lcy on 16/4/6.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "DSSHProjectRockVC.h"
#import "DSSHPointMaterialVC.h"
@interface DSSHProjectRockVC ()
@property(nonatomic,strong)UIImageView* phoneImageView;
@end

@implementation DSSHProjectRockVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"摇一摇";
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    UIBarButtonItem * backBarBtn = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStylePlain target:self action:@selector(backBarBtnClick)];
    self.navigationItem.leftBarButtonItem = backBarBtn;

    self.phoneImageView = [UIImageView new];
    self.phoneImageView.image = [UIImage imageNamed:@"shoujiyaoyiyao"];
    self.phoneImageView.center = self.view.center;
    self.phoneImageView.bounds = CGRectMake(0, 0, 119*WIDTH_SCALE, 136*HIGHT_SCALE);
    [self.view addSubview:self.phoneImageView];
    
    [[UIApplication sharedApplication] setApplicationSupportsShakeToEdit:YES];
    
    [self becomeFirstResponder];
    [self performSelector:@selector(jumpNext) withObject:self afterDelay:2];
    // Do any additional setup after loading the view.
}
-(void)backBarBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)jumpNext
{
    DSSHPointMaterialVC * vc = [[DSSHPointMaterialVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
- (void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event

{
    NSLog(@"begin");
//    self.btn.backgroundColor = [UIColor orangeColor];
}
- (void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event

{
    
    //摇动结束
    
    if (event.subtype == UIEventSubtypeMotionShake) {
        NSLog(@"end");
        
        //something happens
//        self.btn.backgroundColor = [UIColor redColor];
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
